layui.define(function(e) {
	layui.use(["admin", "carousel"], function() {
		var e = layui.$,
			a = (layui.admin, layui.carousel),
			t = layui.element,
			i = layui.device();
		e(".layadmin-carousel").each(function() {
			var t = e(this);
			a.render({
				elem: this,
				width: "100%",
				arrow: "none",
				interval: t.data("interval"),
				autoplay: t.data("autoplay") === !0,
				trigger: i.ios || i.android ? "click" : "hover",
				anim: t.data("anim")
			})
		}), t.render("progress")
	}), layui.use(["carousel", "echarts"], function() {
		var e = layui.$,
			a = (layui.carousel, layui.echarts);
		initCharts = function(option, id,func) {
			var t = [],n = e("#" + id).children("div"),l = function(e) {
					t[e] = a.init(n[e], layui.echartsTheme), t[e].setOption(option[e]), window.onresize = t[e].resize;
					t[e].on('click', function (params) { 
						func(params)
					});
				};
			if(n[0]) {
				l(0);
			}
		}
		function clickObj(params){
			parent.appHrefApi('门诊日报明细','department/department_daily_sub_1.html');
//			window.location.href='department_daily_sub_1.html';
		}
		// 医保自费金额
		var o_normcol = [{
			tooltip: {
				trigger: "axis"
			},
			legend: {
				data: ["医保", "自费"]
			},
			calculable: !0,
			xAxis: [{
				type: "category",
				data: ["初诊", "复诊"]
			}],
			yAxis: [{
				type: "value"
			}],
			series: [{
				name: "医保",
				type: "bar",
				data: [1717.4, 6773.4],
				markPoint: {
					data: [{
						type: "max",
						name: "最大值"
					}, {
						type: "min",
						name: "最小值"
					}]
				}
			}, {
				name: "自费",
				type: "bar",
				data: [1319.3, 850.7],
				markPoint: {
					data: [{
						type: "max",
						name: "最大值"
					}, {
						type: "min",
						name: "最小值"
					}]
				}
			}]
		}]
		initCharts(o_normcol, "medical-amount-normcol",clickObj);

		// 医保自费（初复诊）合计
		var o_num = [{
			tooltip: {
				trigger: 'axis'
			},
			calculable: true,
			legend: {
				data: ['金额', '人数']
			},
			xAxis: [{
				type: 'category',
				data: ['医保初诊', '医保复诊', '自费初诊', '自费复诊']
			}],
			yAxis: [{
					type: 'value',
					name: '金额（元）',
					axisLabel: {
						formatter: '{value}'
					}
				},
				{
					type: 'value',
					name: '人数',
					axisLabel: {
						formatter: '{value}'
					}
				}
			],
			series: [

				{
					name: '金额',
					type: 'bar',
					data: [1717.4, 6773.4, 1319.3, 850.7]
				},
				{
					name: '人数',
					type: 'line',
					yAxisIndex: 1,
					data: [22, 145, 28, 19]
				}
			]
		}]
		initCharts(o_num, "medical-num-normcol",clickObj);

		// 医保自费合计
		var o_amount = [{
			tooltip: {
				trigger: 'axis'
			},
			calculable: true,
			legend: {
				data: ['总金额', '人均金额', '人数']
			},
			xAxis: [{
				type: 'category',
				data: ['医保', '自费', '总计']
			}],
			yAxis: [{
					type: 'value',
					name: '总金额（元）',
					axisLabel: {
						formatter: '{value}'
					}
				},
				{
					type: 'value',
					name: '人数',
					axisLabel: {
						formatter: '{value}'
					}
				}
			],
			series: [
				{
					name: '总金额',
					type: 'bar',
					data: [8490.8, 2169.9,10660.8]
				},
				{
					name: '人均金额',
					type: 'bar',
					data: [50.8, 46.2,49.8]
				},
				{
					name: '人数',
					type: 'line',
					yAxisIndex: 1,
					data: [167, 47,214]
				}
			]
		}]
		initCharts(o_amount, "medical-amount",clickObj);

		// 医保自费人数
		var o_people = [{
			tooltip: {
				trigger: "axis"
			},
			legend: {
				data: ["医保", "自费"]
			},
			calculable: !0,
			xAxis: [{
				type: "category",
				data: ["初诊", "复诊"]
			}],
			yAxis: [{
				type: "value"
			}],
			series: [{
				name: "医保",
				type: "bar",
				data: [22, 145],
				markPoint: {
					data: [{
						type: "max",
						name: "最大值"
					}, {
						type: "min",
						name: "最小值"
					}]
				}
			}, {
				name: "自费",
				type: "bar",
				data: [28, 19],
				markPoint: {
					data: [{
						type: "max",
						name: "最大值"
					}, {
						type: "min",
						name: "最小值"
					}]
				}
			}]
		}]
		initCharts(o_people, "medical-people-num",clickObj);

	}), e("department_daily", {})
});